Why doesn't my .tfignore file ignore my packages folder - asp.net

I am using Visual Studio 2013 Pro and Team Foundation Server 2013. I have a .tfignore file with the following lines:
\packages
\<project name>\Bin
!\<project name>\Bin\*.refresh
Line 1 is not working but lines 2 and 3 are. The project name above is a website inside a solution. There is nothing else in this solution. There are nuget packages installed which automatically pull down when you publish or build the website. When that happens this package folder is created in the solution. It's not added to the solution explorer, it's just in the same folder as the solution when you look at the filer in file explorer.
Please let me know if there is any other information you need.

You can control this in NuGet.config.
Make sure the key "disableSourceControlIntegration" exists and is set to "true":
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
References:
http://docs.nuget.org/docs/Reference/Package-Restore
http://docs.nuget.org/docs/Reference/NuGet-Config-Settings

If your packages are already in TFS, you should first "undo pending changes" on your local, delete them from TFS Source files and then, check in In Visual Studio. That will removed the packages from the server and will not ask to check them in again.

Related

Error MSB3030 Could not copy the file "C:\Users\...\WebApi3\obj\Debug\netcoreapp3.0\webapi3.exe" because it was not found

Hi Stackoverflow Community,
I am trying to build my Web and WebAPI, console applications with Target Framework - .NET Core 3.0, as per project 'Application' properties, using:
Microsoft Visual Studio Community 2019
Version 16.5.4 on Windows 10 PRO
I am seeing the following errors:
Error MSB3030 Could not copy the file "C:\Users...\WebApi3\obj\Debug\netcoreapp3.0\webapi3.exe" because it was not found
and
Error MSB3030 Could not copy the file "C:\Users...\Web\obj\Debug\netcoreapp3.0\webportal.exe" because it was not found
Hence these projects are not getting built.
Appreciate your time for reading this.
Please advise.
Here is the part of the code where the error points to:
============================================================
_CopyOutOfDateSourceItemsToOutputDirectory
Copy files that have the CopyToOutputDirectory attribute set to 'PreserveNewest'.
============================================================
-->
<Target
Name="_CopyOutOfDateSourceItemsToOutputDirectory"
Condition=" '#(_SourceItemsToCopyToOutputDirectory)' != '' "
Inputs="#(_SourceItemsToCopyToOutputDirectory)"
Outputs="#(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')">
<!--
Not using SkipUnchangedFiles="true" because the application may want to change
one of these files and not have an incremental build replace it.
-->
<Copy
SourceFiles = "#(_SourceItemsToCopyToOutputDirectory)"
DestinationFiles = "#(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForAdditionalFilesIfPossible)"
>
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
I faced the same issue in VS2022(17.0.1) as well. I performed below steps based on a github issue [https://github.com/dotnet/sdk/issues/3122] discussion and my issue got resolved. I believe this works for VS2019 as well.
Step1: Clean Local Nuget Cache
..\projectDir> dotnet nuget locals all --clear
Step2: remove bin and Obj folders
..\projectDir> rd \s \q bin obj
Step3: Clean the solution using Visual studio build menu
Step4: Rebuild Project
Updating Visual Studio to 16.5.5. seems to have solved the issue so far.
I had a similar issue but whilst attempting to publish. The affected .DLL was a nuget package and I noticed I had an update for it.
Updating the affected package, cleaning the solution, rebuilding then re-publishing resolved my issue.
For CoreXT repos by default only outputs under obj for retail builds or objd for debug builds are collected. You seem to be using the retail bridge and using obj(Debug|Release) and bin (the MSBuild non-CoreXT defaults), so those outputs are not being collected.
To remedy this, you can set the -UsePredictedOutputPath QuickBuild flag which will avoid collecting those hard-coded paths and instead ask each project what its $(IntermediateOutputPath) and $(OutputPath) are and use those.
Note that in either case, outputs under output roots (eg /target) are always collected. This flag only affects the project-relative outputs.

A product matching the following parameters cannot be found during VS Installation

I've tried all the solution available at StackOverflow and VS developer community but I'm unable to resolve the error saying.
A product matching the following parameters cannot be found:
channelId: VisualStudio.15.Release
productId: Microsoft.VisualStudio.Product.Community
Here are the solutions that I've tried.
tried deleting the VS folder in Program Files
tried running InstallCleanup.exe -i with cmd (as administrator)
tried running InstallCleanup.exe -f with cmd (as administrator)
tried deleting VS packages from Program Data
tried installing with new and old both packages
I had this problem and was able to solve with following steps
Open a command prompt with admin privileges
Run following command (this will clean up previous install cache. -full option is important)
"%programfiles(x86)%\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe" -full
Restart the installer
Hope this helps. Just to add, I did not have to uninstall VS 2015 for this to work.
Follow these steps and your issue will be resolved:
UNINSTALL
Please navigate to C:\Program Files x86 and search for a Microsoft Visual Studio folder. Then right click and delete that folder.
Then remove only Visual Studio folders from these 2 locations, if they are there:
C:\Users\YOUR_USER\AppData\Local\Microsoft
C:\ProgramData\Microsoft
Lastly, please type regedit in the lower left search field to access the registry editor... Once it's open navigate to HKEY LOCAL MACHINE > SOFTWARE > MICROSOFT and check for a Visual Studio folder there. If you see one there, right click and delete the folder.
BEFORE INSTALLING AGAIN
Before you attempt your installation again, make certain you are following these guidelines below:
Restart.
Make sure your Windows is up-to-date, check for any pending Windows Updates.
Disable any anti-virus/firewall temporarily (this includes Windows Defender). Installer needs unblocked access to the internet to access Microsoft Servers.
Clean up the (C:\Windows\Temp) folder.
When launching the Installer, Right Click and select "Run as Admin"
Overlooking the above steps results in most installations failures.
For people looking for solutions to VS2019 issue, The InstallCleanup.exe is under "Installer" directory instead of its subdir.
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\InstallCleanup.exe" -full

NETSTANDARD error Build action 'EmbeddedResource' is not supported by one or more of the project's targets

We migrate our project to NET STANDARD, but when the project is compiled many errors appear on the errors list:
Severity Code Description Project File Line Suppression State
Error Build action 'EmbeddedResource' is not supported by one or more of the project's targets. MyApp C:\desenvolvimento\aplicativo\App\MyApp\App.xaml 0
the project runs normally but many of this errors appears...
i am using the latest version of Visual Studio 2015 and Xamarin, all the libs and softwares are up to date.
These are only Intellisense errors. If you just switch your error list filter to Build Only (instead of Build + Intellisense), then you will see that they disappear and your project will continue to build.
If your project is building correctly but these errors persist, this is because Visual Studio keeps a cache of the errors on .suo (Solution User Options) and sometimes these errors are not refreshed as should.
To force refresh close Visual Studio and delete all .suo files (including inside .vs folder). You will loose all state for this project (open files and windows, windows positions etc).
I had this issue and searched online, eventually found this answer https://forums.xamarin.com/discussion/comment/89268/#Comment_89268
It looks like a tag in the older VS solution file is the cause.
As stated in the answer, you can fix the build error by opening up the .csproj file in a text editor, finding the EnsureNuGetPackageBuildImports Target and removing it.
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Xamarin.Forms.1.2.2.6243\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)','..\packages\Xamarin.Forms.1.2.2.6243\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets'))" />
</Target>
Loaded solution and all working.

Deployment hell, Microsoft.Web.Infrastructure.dll

We have to deploy our web project on several (possible 10) servers , We've developed Nant script that doing the Job , but We've face with problem , that Microsoft.Web.Infrastructure.dll that is one of the dependencies doesn't deployed what ever we do.
Could anyone please explain how can add reference to this dll , and mark it copy local or something ? I'll try to explain what's hapening , when I am adding reference to this dll to our proj , the reference added to web.config like :
<assemblies>
<add assembly .... blah blah />
</assemblies>
This means that assembly should be in GAC , right ? I can see it well if I am clicking on Property Pages in visual studio , and going to refereces tab , I can see that this Dll is in Gac.
Ok , the following command
gacutil.exe -l Microsoft.Web.Infrastructure returns with no Result !
So where is this assembly stored ? How the magic is done by Microsoft ???
How can I remove it from GAC ???
Anyone ?
PS. One of the possible resolutions that I've found on web. Is to run Package Manager and install it from there again ... but for me it's not a options , we aren't connected to internet for security reasons.
If you've developed against MVC assuming its installed in the GAC why don't you just install it on the target server via http://www.asp.net/mvc/mvc3
The copy local solution is great if you've got a proj file to work with but you don't as you opted for a website project which is all sln and web.config.
You could add a reference via your websites property page (from your nuget package)
You sound like you already have nuget package but if not you just right click on the bin folder and manage packages - Microsoft.Web.Infrastructure - install
If you add this package reference to your bin folder you'll see a new file:
bin\Microsoft.Web.Infrastructure.dll.refresh
This just contains a link to actual dll in the package - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll
The dll will get copied over to the bin folder at build time.
I would suggest you use webmatrix / web platform installer to install the DLL on each of the servers.

"Can't find the valid AspnetMergePath" on Visual Web Developer Publish?

I am wanting to use Visual Web Developer Express 2010 to publish a website, pre-compiled to a remote server over FTP using the following settings:
Deploy only files needed to run this application
Precompile this application before publishing
Allow website to be updatable
No databases are being deployed
Site is being deployed as file hierarchy, not as .zip package
My first build/deploy seemed to have gone well, but after my second compilation I receive the following error:
Transformed web.config using C:\path_to_site\Web.Debug.config into obj\Debug\TransformWebConfig\transformed\web.config.
Copying all files to temporary location below for package/publish:
obj\Debug\AspnetCompileMerge\Source.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.5\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(132,5): Error : Can't find the valid AspnetMergePath
And here's a subset of the content of the Microsoft.Web.Publishing.AspNetConfigurationMerge.targets file:
<Target
Name="GetAspNetMergePath"
DependsOnTargets="$(GetAspNetMergePathDependsOn)"
Condition ="'$(GetAspNetMergePath)' != 'false'">
<PropertyGroup>
<AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
<AspnetMergePath Condition="Exists('$(TargetFrameworkSDKToolsDirectory)$(AspnetMergeName)')">$(TargetFrameworkSDKToolsDirectory)</AspnetMergePath>
</PropertyGroup>
<Error Condition="'$(AspnetMergePath)' == '' Or !Exists($(AspnetMergePath))"
Text="Can't find the valid AspnetMergePath" />
</Target>
EDIT: Changing the publish settings to delete all existing files before publishing does not fix the problem after all. I'm assuming that the problem is local for now because of this.
There does not appear to be an AspMergePath tag in my web.config. I am not aware if I am supposed to manually add the tag. However, the path "obj{publish setting}\AspnetCompileMerge\Source" does exist in my project.
And in case it matters, my project name is "TestProject.NET"
Your feedback is appreciated.
I hit the same problem. Searched through all microsoft related sites, found a lot of complaints and no intention from microsoft to fix it.
Here how I worked it around at my system. Edit the Microsoft.Web.Publishing.AspNetConfigurationMerge.targets file and add the following line. Please make sure that the Microsoft SDK path is the same on your PC, if not then change it:
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\</TargetFrameworkSDKToolsDirectory>
Here is how it should look like:
<Target
Name="GetAspNetMergePath"
DependsOnTargets="$(GetAspNetMergePathDependsOn)"
Condition ="'$(GetAspNetMergePath)' != 'false'">
<PropertyGroup>
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\</TargetFrameworkSDKToolsDirectory>
<AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
<AspnetMergePath Condition="Exists('$(TargetFrameworkSDKToolsDirectory)$(AspnetMergeName)')">$(TargetFrameworkSDKToolsDirectory)</AspnetMergePath>
</PropertyGroup>
<Error Condition="'$(AspnetMergePath)' == '' Or !Exists($(AspnetMergePath))"
Text="Can't find the valid AspnetMergePath" />
What you need is aspnet_merge.exe, tool that is distributed as part of Windows SDK. It's intended to precompile sites, so you can either turn that precompilation off, or install proper version of Windows SDK. Reference is to the Wikipedia, because of nice prepared links to the download pages. You don't need to download/install everything (it's huge), just download web installer and select .Net tools, it will take around 50 megabytes.
Please, notice that bundled with Visual Studio 2010 Windows SDK ver. 7.0A isn't available to separate download, so you'll have to either install Visual Studio on your build server, or tweak something as described in answers to "Running MSBuild fails to read SDKToolsPath".
Here is a solution that does not require changing the targets file. The workaround from http://connect.microsoft.com/VisualStudio/feedback/details/786492/publish-cant-find-the-valid-aspnetmergepath suggests passing additional properteries to msbuild. I was able to get it to work using this:
msbuild website.publishproj /p:DeployOnBuild=true /p:PublishProfile=Release /p:VisualStudioVersion=12.0 /p:AspnetMergePath="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\"
The key here is the AspnetMergePath property, which you may need to change if the Windows SDK is installed in a different location. If I include the GetAspNetMergePath property from the workaround it fails, but that may be needed depending on the SDK version.
One workaround for all this stuff [including having to install the SDK etc] is to disable the Precompile On Publish option, which requires AspNetMerge to be present even if you're not specifying that you want stuff to be merged in the ultimate output.
I was going to great lengths to figure out how to turn it off, poring over the options dialog and Reading the Friendly Manual to confirm I had it turned off for ages only to realize it was the checkbox outside:
Unchecking yields the following changes to the .pubxml:
- <PrecompileBeforePublish>True</PrecompileBeforePublish>
- <EnableUpdateable>True</EnableUpdateable>
- <DebugSymbols>False</DebugSymbols>
- <WDPMergeOption>DonotMerge</WDPMergeOption>
Which worked for me.
NB it is however critical to have as covered here both the Web (which will silently make publishing via /p:DeployOnBuild inert) and the WebApplications (which will give a compiler error) subfolders present under %Program Files (x86)%\MSBuild\Microsoft\VisualStudio\v14.0 (assuming Visual Studio 2015 tooling) for publishing to successfully generate packages
I hit the same problem.
Edit the Microsoft.Web.Publishing.AspNetConfigurationMerge.targets file and add the following line. Make sure run editor with Administrator Rights.
Looks the correct versiĆ³n Visual Studio in my case VS2013.
x64
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\</TargetFrameworkSDKToolsDirectory>
x86
<TargetFrameworkSDKToolsDirectory>C:\Program Files\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\</TargetFrameworkSDKToolsDirectory>
And it Works! I can compile my Project.
In my case was missing. It happened after updating Visual Studio 2017 to 15.7.5. Before that it was working fine. I have to add
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\</TargetFrameworkSDKToolsDirectory>
It was at Line no 129 in Microsoft.Web.Publishing.AspNetCompileMerge.targets
change targetFramework ...
<compilation debug="true" targetFramework="4.8"/>
<httpRuntime targetFramework="4.8"/>

Resources