Question: I have a data frame containing weights for stocks in a portfolio, it is around 1000 stocks and 4000 days of data. I want to apply the weights of the first day of each month to all days of that month. However, I still want to retain the structure of daily data.

My data is similar to this:

```
data <- as.data.frame(matrix(1:4000, nrow = 200, ncol = 20))
rownames(data) <- seq(as.Date("2018/01/01"), as.Date("2018/07/19"), 1)

```

So I want to have the values of the first of January copied to all days of January, values of the first day of February copied to all days in Februari etc.
I have no clue how to handle this.

Any tips?

Answer: 
> 
> If I manually have to replace the (Import Project="..\packages...)
>  elements in the project file, what should I change it to, so that it
>  follows the configuration from the Nuget.config?
> 
> 
> 

Since you use the new `nuget.config` file which changed the path of the local nuget reference(like this `<add key="repositoryPath" value="xxxxxx" />`). 

And **Restore** will only restore the missing nuget packages but will not change to use the new nuget package location in `xxx.csproj`.

So you can follow my steps to resolve the issue:

**Solution**

**1)** Tools-->Nuget Package Manager-->Package Manager Console-->

type `Update-Package -reinstall` to reinstall these packages to reference the new right path.

**2)** enter the `xxxx.csproj` file, delete these duplicate, old `import` info like these:

```
 <Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\..\..\..\..\..\installed_packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />

 <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />

```

**3)** Then rebuild your project and will solve this issue.

**Update 1**

The new `Nuget.config` file will specify that the newly installed nuget packages use the new reference address, but for previously installed nuget packages, the reference address in the `xxx.csporj` file will remain the old address. The **Restore** procedure only restores the nuget package under the new path, but it does not make any changes to the nuget reference in `xxx.csproj` file, so it can only be reinstalled.

**Besides**, the import node is created by `Microsoft.Net.Compilers` props file from the `build` folder in the `microsoft.net.compilers`nuget package. And [it is a nuget mechanism](https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package#include-msbuild-props-and-targets-in-a-package) which can do some operation in `xxx.csproj` file when you install the nuget package. 

**However**, this file is also special and when you change the nuget reference path. 
**Because** nuget enabled the new address mechanism, during the uninstallation process, the old address of `Microsoft.Net.Compilers.props` is still not recognized, so it cannot be uninstalled. **In fact**, when you execute the reinstall nuget package, a new address has been created in the `xxx.csproj` file. See this:

[![enter image description here](https://i.stack.imgur.com/e16RA.png)](https://i.stack.imgur.com/e16RA.png)

So you should just delete duplicate files from the old address.
[Visual Studio option to change the Nuget Package References](https://i.stack.imgur.com/UGAJu.png)

* In Visual Studio Tools=> Nuget Package Manager => Package Sources.
* You can change the package sources here.