问题
I created SSIS packages and used the Integration Services Deployment Wizard to deploy it out to the server. I'm manually going to the Integration Services Catalog access through SQL Server 2012 and right-clicking and executing my package.
However, the package keeps failing and I'm getting the following errors when I check the execution report's messages.
They appear to be failing on data tasks where I have script components.
Assign :Error: CS2001 - Source file 'C:\Windows\TEMP.NETFramework,Version=v4.0.AssemblyAttributes.cs' could not be found, CSC, 0, 0
Assign :Error: Failed to compiled scripts contained in the package. Open the package in SSIS Designer and resolve the compilation errors.
回答1:
This answer is a more detailed version of UberDoodles answer.
In Windows Explorer.
- Navigate to
C:\Windows\Temp\
- Right click the folder and select
properties
- Go to tab
Security
, chooseAdvanced
- On the default tab
Permissions
, chooseChange Permissions
- For the relevant Permission entry, choose
edit
. - By default, I had 'allow' checked for
Traverse folder / execute file
,Create files / write data
andCreate folders / append data
. - Also check 'allow' for
List folder / read data
andTake ownership
. - Press OK, the window closes
- Press Apply and confirm anything you need.
Additionally, the logged in user had already Full control, but when I changed this for the entry 'Users', it worked for me.
(based on microsoft file/folder permissions).
回答2:
I had the same problem today, just on SQL 2016. For me it helped to change the target server version in Visual Studio project properties from SQL Server 2012 to SQL Server 2016.
回答3:
I was investigating the same issue, and I came across a solution here :
https://social.msdn.microsoft.com/Forums/vstudio/en-US/73e67f3a-c575-4c73-a71d-ed7a2aeabb50/csc-error-cs2001-source-file-cwindowstempnetframeworkversionv40assemblyattributescs?forum=msbuild
Basically, the account which the package runs under needs to have full permissions to the C:\Windows\Temp\ folder, so that it can create temporary classes.
It worked for me :)
回答4:
I had the same problem. I first used Eric G. response and added the List
and Read
permission to the c:\windows\temp
. After I got everything working I went back and removed that permission. I then redeployed my solution from Visual Studio, this time designating the deployment target as SQL Server 2014
(which was the environment I was using) using Martin's solution. I then reran the process, and it worked with the List
and Read
removed.
I kept it using Martin's solution, as I don't like to have special permissions granted if I don't need them.
Good Luck
回答5:
[Visual Studio 2017 15.9.16]
I just restarted Visual Studio as Administrator and the issue disappeared, which confirms the permissions idea of the answers above but spared me all work.
It's not a quirk though, as per this question and its answer you need that kind of permission for several tasks, like profiling and debugging under certain conditions.
For the sake of completeness, this blog says you might incur in some security contraindication if run VS as administrator when opening third-party solutions.
来源:https://stackoverflow.com/questions/35347632/cs2001-missing-assemblyattributes-cs-when-executing-ssis-package-deployed-to-the